<template>
  <div>
    <div id="line" style="width: 100%; height: 100%" />
  </div>
</template>
<script>
// 导入echarts包
import * as echarts from 'echarts'
// 指定一个dom元素，来显示图标
// var option
export default {
    props: {
        lineData: {
            type: Array
        }
    },
  data() {
    return {
        option: {
            xAxis: {
              type: 'category',
              data: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
            },
            yAxis: {
              type: 'value'
            },
            series: [
              {
                data: this.lineData,
                type: 'line',
                smooth: true
              }
            ]
        }
    }
  },
  mounted() {
    var chartDom = document.getElementById('line')
    var myChart = echarts.init(chartDom)
    this.option && myChart.setOption(this.option)
  }
}
</script>
